package jjn.acwing;

import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * @author Jiang Jining
 * @since 2023-07-15 14:45
 */
public class Acwing785 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] nums = IntStream.range(0, n).map(i -> in.nextInt()).toArray();
        quicksort(nums, 0, n - 1);
        IntStream.range(0, n).mapToObj(i -> nums[i] + " ").forEach(System.out::print);
    }
    
    static void quicksort(int[] nums, int left, int right) {
        if (left >= right) {
            return;
        }
        int i = left - 1, j = right + 1, x = nums[left + right >> 1];
        while (i < j) {
            while (nums[++i] < x)
                ;
            while (nums[--j] > x)
                ;
            if (i < j) {
                int temp = nums[i];
                nums[i] = nums[j];
                nums[j] = temp;
            }
        }
        quicksort(nums, left, j);
        quicksort(nums, j + 1, right);
    }
}
